import { _decorator, Component, Node, RigidBody2D } from 'cc';
import { PropType } from '../Common';
import { AudioMgr } from '../../AudioMgr/AudioMgr';
const { ccclass, property } = _decorator;

@ccclass('PropItem')
export class PropItem extends Component {
    
    @property
    pType:PropType=PropType.addDamage;
    start() {

    }
    
    desSelf(){
        AudioMgr.Inst.playEffectSync("get-prop");

        this.scheduleOnce(()=>{
        
            this.node.active=false;
        this.node.getComponent(RigidBody2D).enabled=false;
            
        },0.05);
        this.scheduleOnce(()=>{
            if(this.node.isValid){

            this.node.destroy();
            }

        },2);
    }
}


